#/bin/bash

#export LD_LIBRARY_PATH=/usr/local/rongan/lib
echo "/usr/local/rongan/lib" >> /etc/ld.so.conf
source ~/.bashrc
ldconfig

#启动pccs服务
cd /opt/intel/sgx-dcap-pccs
nohup node pccs_server.js > output.log 2>&1 & 

#启动aesm服务
cd /opt/intel/sgx-aesm-service/aesm
export LD_LIBRARY_PATH=.
nohup ./aesm_service --no-daemon > /dev/null 2>&1 & 

#启动代理程序
#nohup /usr/local/rongan/bin/ra_local_tcpws/ra_local_tcpws -c /usr/local/rongan/conf/tcpws.yaml 2>1 &
cd /usr/local/rongan/bin/service
bash init_proxy.sh 2

#启动grpc
cd /usr/local/rongan/tee/service/mpc_grpc_server
nohup python3 ra_sgx_tee_grpc_server.py --port 9400 > output.log 2>&1 &

ln -s /opt/intel/sgx-dcap-pccs/pckcache.db /usr/local/rongan/tee/conf/pckcache.db

#启动http服务

while true
    do sleep 3600
done